/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.fimuni.pa165.frontend.propertyeditor;

import cz.fimuni.pa165.backendapi.dto.CompanyDTO;
import cz.fimuni.pa165.backendapi.facade.ServiceFacade;
import java.beans.PropertyEditorSupport;

/**
 *
 * @author Ondřej Myška
 */
public class CompanyDTOPropertyEditor extends PropertyEditorSupport {

    
    private ServiceFacade sf;

    public CompanyDTOPropertyEditor(ServiceFacade sf) {
        this.sf = sf;
    }
   
    
    @Override
    public void setAsText(String id) {
        CompanyDTO company = sf.getCompanyById(Long.parseLong(id));
        setValue(company);
    }
    
    
    
    
}
